package exception;

import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;

public class AutoCloseableDemo {
    public static void main(String[] args) {
        try(FileOutputStream fos = new FileOutputStream("fos.txt");
            OutputStreamWriter osw = new OutputStreamWriter(fos);
        ) {
            osw.write("奥利给");
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
